package client;

import interfaces.Tuple;

/**
 * @author  carlo
 */
@SuppressWarnings("serial")
public class TwoValueTuple implements Tuple{

	private String val1 = null;
	private String val2 = null;

	/**
	 * @return
	 * @uml.property  name="val1"
	 */
	public String getVal1() {
		return val1;
	}

	/**
	 * @param val1
	 * @uml.property  name="val1"
	 */
	public void setVal1(String val1) {
			this.val1 = val1;
	}

	/**
	 * @return
	 * @uml.property  name="val2"
	 */
	public String getVal2() {
		return val2;
	}

	/**
	 * @param val2
	 * @uml.property  name="val2"
	 */
	public void setVal2(String val2) {
			this.val2 = val2;
	}
	
	

	public boolean match(Tuple t) {
		TwoValueTuple tvt = (TwoValueTuple) t;
		if (tvt.val1.equals(this.val1) && tvt.val2.equals(this.val2)) {
			return true;
		}
		if (tvt.val1.equals(this.val1) && tvt.val2.equals("")) {
			return true;
		}
		
		if (tvt.val1.equals("") && tvt.val2.equals(this.val2)) {
			return true;
		}
		if (tvt.val1.equals("") && tvt.val2.equals("")) {
			return true;
		}
		
		
		return false;
	}

	public String toString(){
		return getVal1() + " " + getVal2();
	}
}
